Page({
    data: {},
    onLoad: function (e) {
        let ths = this;
        getApp().request({
            url: getApp().api.city.list,
            success: function(t) {
                ths.setData({
                    hotCity: t.hotCity,
                    cityList: t.cityList,
                    cityListAll: t.cityListAll,
                    currentLocation: e.addresstext
                })
            }
        });
    },
    getStatus(e) {
        this.setData({
            status: e.currentTarget.dataset.index
        })
    },
    bindKeyInput(e) {
        let ths = this,
            e_val = e.detail.value,
            tcityList = ths.data.cityListAll,
            arr = [];
        if (e_val) {
            for (var i = 0; i < tcityList.length; i++) {
                if (tcityList[i].indexOf(e_val) >= 0) {
                    arr.push(tcityList[i])
                    ths.setData({
                        cityAll: arr,
                        ShowSearch: true
                    })
                }
            }
        } else {
            ths.setData({
                ShowSearch: false
            })
        }
    },
    ChoiceCity(e) {
        let city = e.currentTarget.dataset.city;
        wx.setStorageSync("city", city);
        wx.setStorageSync("isRefurbished", true);
        wx.navigateBack();
    }
})